package cn.msn.system.listener;

import cn.msn.system.service.IPermissionService;
import org.springframework.beans.factory.annotation.Autowired;

import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;
import javax.servlet.annotation.WebListener;

/**
 * @author zyg
 */
/*
 项目已启动 servletcontext会创建
 servletcontextlistener起作用
 自动执行上下文
 */
@WebListener
public class PermissionScanInitListener implements ServletContextListener {
    @Autowired
    private IPermissionService permissionService;
    @Override
    public void contextInitialized(ServletContextEvent sce) {
        System.out.println("-------扫描权限注解开始----------");
        permissionService.scanPermission();
        System.out.println("-------扫描权限注解结束----------");
    }
}
